<!--
 * @Author: your name
 * @Date: 2021-10-29 11:12:34
 * @LastEditTime: 2021-11-02 17:26:01
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue_test\src\components\Test.vue
-->
<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <!-- <h2 v-show="isShow" class="go">你好啊！</h2> -->
    <transition name="hello" appear>
      <h2 v-show="isShow" class="go">你好啊！</h2>
    </transition>
  </div>
</template>

<script>
export default {
  name: "Test",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style scoped>
h2 {
  background-color: orange;
}
.hello-enter-active {
  animation: atguigu 1s linear;
}
.hello-leave-active {
  animation: atguigu 1s reverse;
}

@keyframes atguigu {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0px);
  }
}
</style>
